package com.shaozi.nc.configuration;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Observer;
import java.util.concurrent.ConcurrentHashMap;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;

import com.shaozi.data.mq.business.ApiCommonConsumer;
import com.shaozi.data.mq.business.MqBusImpl;
import com.shaozi.data.mq.business.bus.substance.PushSubstanceHandlerFactory;
import com.shaozi.data.mq.business.bus.substance.QuartzSubstanceHandler;
import com.shaozi.data.mq.business.bus.substance.SubstanceFactory;
import com.shaozi.data.mq.business.bus.substance.SubstanceHandler;
import com.shaozi.data.mq.business.bus.substance.SubstanceHandlerFactory;
import com.shaozi.data.mq.business.bus.substance.SyncSubstanceHandlerFactory;
import com.shaozi.data.mq.business.bus.target.TargetBuilder;
import com.shaozi.data.mq.business.bus.target.TargetBuilderCenter;
import com.shaozi.data.mq.business.bus.target.TargetBuilderFactoryImpl;
import com.shaozi.data.mq.business.bus.translation.Translation;
import com.shaozi.data.mq.business.bus.translation.TranslationFactory;
import com.shaozi.data.mq.protocol.stomp.StompConnectionBuilder;
import com.shaozi.lib.observer.CommonObservable;
import com.shaozi.nc.io.mq.MakeSecretaryReadProducer;
import com.shaozi.nc.io.mq.OAPushDataProducer;
import com.shaozi.nc.io.mq.OrgGroupProducer;
import com.shaozi.nc.io.mq.OrgPushMsgProducer;
import com.shaozi.nc.manage.observer.ApproveObserver;
import com.shaozi.nc.manage.observer.AttendanceObserver;
import com.shaozi.nc.manage.observer.ReportObserver;
import com.shaozi.nc.manage.observer.TaskObserver;
import com.shaozi.nc.mq.producer.SecretaryTextProducer;
import com.shaozi.nc.mq.producer.SendIMInfoProducer;
import com.shaozi.nc.mq.substance.ApprovePushSubstance;
import com.shaozi.nc.mq.substance.AttendancePushSubstance;
import com.shaozi.nc.mq.substance.AttendanceSyncSubstance;
import com.shaozi.nc.mq.substance.BriefReportPushSubstance;
import com.shaozi.nc.mq.substance.CompanyUserInfoSubstance;
import com.shaozi.nc.mq.substance.CrmCustomPushSubstance;
import com.shaozi.nc.mq.substance.CrmSalePushSubstance;
import com.shaozi.nc.mq.substance.OperationPushSubstance;
import com.shaozi.nc.mq.substance.OtherPushSubstance;
import com.shaozi.nc.mq.substance.PlatformPushSubstance;
import com.shaozi.nc.mq.substance.QuartzPushSubstance;
import com.shaozi.nc.mq.substance.ReportPushSubstance;
import com.shaozi.nc.mq.substance.TaskPushSubstance;
import com.shaozi.nc.mq.target.ApproveTargetBuilder;
import com.shaozi.nc.mq.target.AttendanceTargetBuilder;
import com.shaozi.nc.mq.target.BriefReportTargetBuilder;
import com.shaozi.nc.mq.target.CrmCustomTargetBuilder;
import com.shaozi.nc.mq.target.CrmSaleTargetBuilder;
import com.shaozi.nc.mq.target.OperationTargetBuilder;
import com.shaozi.nc.mq.target.OtherTargetBuilder;
import com.shaozi.nc.mq.target.PlatformTargetBuilder;
import com.shaozi.nc.mq.target.ReportTargetBuilder;
import com.shaozi.nc.mq.target.TaskTargetBuilder;
import com.shaozi.nc.mq.translation.ApprovePushTranslation;
import com.shaozi.nc.mq.translation.AttendancePushTranslation;
import com.shaozi.nc.mq.translation.BriefReportTranslation;
import com.shaozi.nc.mq.translation.CrmCustomPushTranslation;
import com.shaozi.nc.mq.translation.CrmSalePushTranslation;
import com.shaozi.nc.mq.translation.DefaultOaPushTranslation;
import com.shaozi.nc.mq.translation.OperationTranslation;
import com.shaozi.nc.mq.translation.PlatformPushTranslation;
import com.shaozi.nc.mq.translation.ReportPushTranslation;
import com.shaozi.nc.mq.translation.TaskPushTranslation;

@Configuration
@Order(2)
public class MqConfiguration {

	@Value("${mq.conn.brokerHost}")
	private String brokerHost;
	@Value("${mq.conn.brokerPort}")
	private Integer brokerPort;
	@Value("${mq.conn.brokerUserName}")
	private String brokerUserName;
	@Value("${mq.conn.brokerPwd}")
	private String brokerPwd;
	@Value("${mq.conn.brokerClientId}")
	private String brokerClientId;

	@Value("${mq.consumer.name}")
	private String consumerName;
	@Value("${mq.consumer.destName.api.task}")
	private String consumerTask;
	@Value("${mq.consumer.destName.api.crm}")
	private String consumerCrm;
	@Value("${mq.consumer.destName.api.report}")
	private String consumerReport;
	@Value("${mq.consumer.destName.api.approve}")
	private String consumerApprove;
	@Value("${mq.consumer.destName.api.attendance}")
	private String consumerAttendance;
	@Value("${mq.consumer.destName.api.badge}")
	private String consumerBadge;
	@Value("${mq.consumer.destName.api.companyUserInfoChange}")
	private String consumerCompanyUserInfoChange;
	@Value("${mq.consumer.destName.api.quartzConsumer}")
	private String consumerQuartz;
	@Value("${mq.consumer.destName.api.platform}")
	private String consumerPlatform;
	@Value("${mq.consumer.destName.api.briefReport}")
	private String consumerBriefReport;
	@Value("${mq.consumer.destName.api.operation}")
	private String consumerOperation;

	public MqConfiguration() {
		super();
	}

	@Bean(name = "stompConnBuilder")
	public StompConnectionBuilder stompConnectionBuilder() {
		StompConnectionBuilder builder = new StompConnectionBuilder();
		builder.setBrokerHost(brokerHost);
		builder.setBrokerClientId(brokerClientId);
		builder.setBrokerPort(brokerPort);
		builder.setBrokerPwd(brokerPwd);
		builder.setBrokerUserName(brokerUserName);
		return builder;
	}

	/******** java mq通道 ***************/
	@Bean
	public OAPushDataProducer oaPushDataProducer(StompConnectionBuilder stompConnBuilder) {
		return new OAPushDataProducer(stompConnBuilder);
	}

	@Bean
	public OrgGroupProducer orgGroupProducer(StompConnectionBuilder stompConnBuilder) {
		return new OrgGroupProducer(stompConnBuilder);
	}

	@Bean
	public OrgPushMsgProducer orgPushMsgProducer(StompConnectionBuilder stompConnBuilder) {
		return new OrgPushMsgProducer(stompConnBuilder);
	}

	@Bean
	public SendIMInfoProducer sendIMInfoProducer(StompConnectionBuilder stompConnBuilder) {
		return new SendIMInfoProducer(stompConnBuilder);
	}

	@Bean
	public SecretaryTextProducer secretaryTextProducer(StompConnectionBuilder stompConnBuilder) {
		return new SecretaryTextProducer(stompConnBuilder);
	}

	@Bean
	public MakeSecretaryReadProducer makeSecretaryReadProducer(StompConnectionBuilder stompConnBuilder) {
		return new MakeSecretaryReadProducer(stompConnBuilder);
	}

	/******** api ***************/
	@Bean(name = "apiTaskConsumer", initMethod = "launch")
	public ApiCommonConsumer apiTaskConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerTask);
		return commonConsumer;
	}

	@Bean(name = "apiCrmConsumer", initMethod = "launch")
	public ApiCommonConsumer apiCrmConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerCrm);
		return commonConsumer;
	}

	@Bean(name = "apiReportConsumer", initMethod = "launch")
	public ApiCommonConsumer apiReportConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerReport);
		return commonConsumer;
	}

	@Bean(name = "apiApproveConsumer", initMethod = "launch")
	public ApiCommonConsumer apiApproveConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerApprove);
		return commonConsumer;
	}

	@Bean(name = "apiAttendanceConsumer", initMethod = "launch")
	public ApiCommonConsumer apiAttendanceConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerAttendance);
		return commonConsumer;
	}

	@Bean(name = "apiBadgeConsumer", initMethod = "launch")
	public ApiCommonConsumer apiBadgeConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerBadge);
		return commonConsumer;
	}

	@Bean(name = "apiCompanyUserInfoChangeConsumer", initMethod = "launch")
	public ApiCommonConsumer apiCompanyUserInfoChangeConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerCompanyUserInfoChange);
		return commonConsumer;
	}

	@Bean(name = "apiQuartzConsumer", initMethod = "launch")
	public ApiCommonConsumer apiQuartzConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerQuartz);
		return commonConsumer;
	}

	@Bean(name = "apiPlatformConsumer", initMethod = "launch")
	public ApiCommonConsumer apiPlatformConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerPlatform);
		return commonConsumer;
	}

	@Bean(name = "apiBriefReportConsumer", initMethod = "launch")
	public ApiCommonConsumer apiBriefReportConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerBriefReport);
		return commonConsumer;
	}

	@Bean(name = "apiOperationConsumer", initMethod = "launch")
	public ApiCommonConsumer apiOperationConsumer(StompConnectionBuilder stompConnBuilder) {
		ApiCommonConsumer commonConsumer = new ApiCommonConsumer(stompConnBuilder);
		commonConsumer.setConsumerName(consumerName);
		commonConsumer.setSimpleDestName(consumerOperation);
		return commonConsumer;
	}

	/************ mq substance ****************/
	@Bean
	public ApprovePushSubstance approvePushSubstance() {
		return new ApprovePushSubstance();
	}

	@Bean
	public AttendancePushSubstance attendancePushSubstance() {
		return new AttendancePushSubstance();
	}

	@Bean
	public CrmSalePushSubstance crmSalePushSubstance() {
		return new CrmSalePushSubstance();
	}

	@Bean
	public CrmCustomPushSubstance crmCustomPushSubstance() {
		return new CrmCustomPushSubstance();
	}

	@Bean
	public OtherPushSubstance otherPushSubstance() {
		return new OtherPushSubstance();
	}

	@Bean
	public ReportPushSubstance reportPushSubstance() {
		return new ReportPushSubstance();
	}

	@Bean
	public TaskPushSubstance taskPushSubstance() {
		return new TaskPushSubstance();
	}

	@Bean
	public QuartzSubstanceHandler quartzSubstanceHandler() {
		return new QuartzSubstanceHandler();
	}

	@Bean
	public AttendanceSyncSubstance attendanceSyncSubstance() {
		return new AttendanceSyncSubstance();
	}

	@Bean
	public PlatformPushSubstance platformPushSubstance() {
		return new PlatformPushSubstance();
	}

	@Bean
	public CompanyUserInfoSubstance companyUserInfoSubstance() {
		return new CompanyUserInfoSubstance();
	}

	@Bean
	public QuartzPushSubstance quartzPushSubstance() {
		return new QuartzPushSubstance();
	}

	@Bean
	public BriefReportPushSubstance briefReportPushSubstance() {
		return new BriefReportPushSubstance();
	}

	@Bean
	public OperationPushSubstance operationPushSubstance() {
		return new OperationPushSubstance();
	}

	@Bean("mqPushSubstanceMap")
	public Map<Integer, SubstanceHandler> mqPushSubstanceMap(TaskPushSubstance taskPushSubstance,
			CrmSalePushSubstance crmSalePushSubstance, CrmCustomPushSubstance crmCustomPushSubstance,
			ApprovePushSubstance approvePushSubstance, AttendancePushSubstance attendancePushSubstance,
			ReportPushSubstance reportPushSubstance, OtherPushSubstance otherPushSubstance,
			QuartzPushSubstance quartzPushSubstance, PlatformPushSubstance platformPushSubstance,
			BriefReportPushSubstance briefReportPushSubstance, OperationPushSubstance operationPushSubstance) {

		ConcurrentHashMap<Integer, SubstanceHandler> mqPushSubstanceMap = new ConcurrentHashMap<>();
		mqPushSubstanceMap.put(7000, taskPushSubstance);
		mqPushSubstanceMap.put(9000, crmSalePushSubstance);
		mqPushSubstanceMap.put(9500, crmCustomPushSubstance);
		mqPushSubstanceMap.put(6500, approvePushSubstance);
		mqPushSubstanceMap.put(8000, attendancePushSubstance);
		mqPushSubstanceMap.put(6000, reportPushSubstance);
		mqPushSubstanceMap.put(19000, otherPushSubstance);

		mqPushSubstanceMap.put(28000, quartzPushSubstance);
		mqPushSubstanceMap.put(28200, platformPushSubstance);
		mqPushSubstanceMap.put(30100, briefReportPushSubstance);
		mqPushSubstanceMap.put(31100, operationPushSubstance);
		return mqPushSubstanceMap;
	}

	@Bean("pushSubstanceFactory")
	public PushSubstanceHandlerFactory pushSubstanceFactory(Map<Integer, SubstanceHandler> mqPushSubstanceMap) {
		PushSubstanceHandlerFactory pushSubstanceFactory = new PushSubstanceHandlerFactory();
		pushSubstanceFactory.setHandlers(mqPushSubstanceMap);
		return pushSubstanceFactory;
	}

	@Bean("mqSyncSubstanceMap")
	public Map<Integer, SubstanceHandler> mqSyncSubstanceMap(AttendanceSyncSubstance attendanceSyncSubstance,
			CompanyUserInfoSubstance companyUserInfoSubstance) {
		ConcurrentHashMap<Integer, SubstanceHandler> mqPushSubstanceMap = new ConcurrentHashMap<>();
		mqPushSubstanceMap.put(27999, attendanceSyncSubstance);
		mqPushSubstanceMap.put(28100, companyUserInfoSubstance);
		return mqPushSubstanceMap;
	}

	@Bean("syncSubstanceFactory")
	public SyncSubstanceHandlerFactory syncSubstanceFactory(
			@Qualifier("mqSyncSubstanceMap") Map<Integer, SubstanceHandler> mqSyncSubstanceMap) {
		SyncSubstanceHandlerFactory syncSubstanceFactory = new SyncSubstanceHandlerFactory();
		syncSubstanceFactory.setHandlers(mqSyncSubstanceMap);
		return syncSubstanceFactory;
	}

	@Bean("substanceFactoryMap")
	public Map<Integer, SubstanceHandlerFactory> substanceFactoryMap(PushSubstanceHandlerFactory pushSubstanceFactory,
			SyncSubstanceHandlerFactory syncSubstanceFactory) {
		ConcurrentHashMap<Integer, SubstanceHandlerFactory> mqPushSubstanceMap = new ConcurrentHashMap<>();
		mqPushSubstanceMap.put(1, pushSubstanceFactory);
		mqPushSubstanceMap.put(2, syncSubstanceFactory);
		return mqPushSubstanceMap;
	}

	@Bean
	public SubstanceFactory substanceFactory(
			@Qualifier("substanceFactoryMap") Map<Integer, SubstanceHandlerFactory> substanceFactoryMap) {
		SubstanceFactory substanceFactory = new SubstanceFactory();
		substanceFactory.setSubstanceHandlerFactoryMap(substanceFactoryMap);
		return substanceFactory;
	}

	/************ mq Translation ****************/
	@Bean
	public ApprovePushTranslation approvePushTranslation() {
		return new ApprovePushTranslation();
	}

	@Bean
	public AttendancePushTranslation attendancePushTranslation() {
		return new AttendancePushTranslation();
	}

	@Bean
	public BriefReportTranslation briefReportTranslation() {
		return new BriefReportTranslation();
	}

	@Bean
	public OperationTranslation operationTranslation() {
		return new OperationTranslation();
	}

	@Bean
	public CrmSalePushTranslation crmSalePushTranslation() {
		return new CrmSalePushTranslation();
	}

	@Bean
	public CrmCustomPushTranslation crmCustomPushTranslation() {
		return new CrmCustomPushTranslation();
	}

	@Bean
	public ReportPushTranslation reportPushTranslation() {
		return new ReportPushTranslation();
	}

	@Bean
	public TaskPushTranslation taskPushTranslation() {
		return new TaskPushTranslation();
	}

	@Bean
	public PlatformPushTranslation platformPushTranslation() {
		return new PlatformPushTranslation();
	}

	@Bean("otherPushTranslation")
	public DefaultOaPushTranslation otherPushTranslation() {
		return new DefaultOaPushTranslation();
	}

	@Bean("mqTranslationMap")
	public Map<Integer, Translation> mqTranslationMap(TaskPushTranslation taskPushTranslation,
			CrmSalePushTranslation crmSalePushTranslation, CrmCustomPushTranslation crmCustomPushTranslation,
			ApprovePushTranslation approvePushTranslation, AttendancePushTranslation attendancePushTranslation,
			ReportPushTranslation reportPushTranslation, BriefReportTranslation briefReportTranslation,
			OperationTranslation operationTranslation, PlatformPushTranslation platformPushTranslation,
			DefaultOaPushTranslation otherPushTranslation) {
		ConcurrentHashMap<Integer, Translation> mqTranslationMap = new ConcurrentHashMap<>();
		mqTranslationMap.put(7000, taskPushTranslation);
		mqTranslationMap.put(9000, crmSalePushTranslation);
		mqTranslationMap.put(9500, crmCustomPushTranslation);
		mqTranslationMap.put(6500, approvePushTranslation);
		mqTranslationMap.put(8000, attendancePushTranslation);
		mqTranslationMap.put(6000, reportPushTranslation);
		mqTranslationMap.put(30100, briefReportTranslation);

		mqTranslationMap.put(31100, operationTranslation);
		mqTranslationMap.put(28200, platformPushTranslation);
		mqTranslationMap.put(19000, otherPushTranslation);
		mqTranslationMap.put(19000, otherPushTranslation);
		return mqTranslationMap;
	}

	@Bean("mqTranslationFactory")
	public TranslationFactory mqTranslationFactory(Map<Integer, Translation> mqTranslationMap) {
		TranslationFactory mqTranslationFactory = new TranslationFactory();
		mqTranslationFactory.setTranslates(mqTranslationMap);
		return mqTranslationFactory;
	}

	/***************** target builder *******************/
	@Bean
	public TaskTargetBuilder taskTargetBuilder() {
		return new TaskTargetBuilder();
	}

	@Bean
	public CrmSaleTargetBuilder crmSaleTargetBuilder() {
		return new CrmSaleTargetBuilder();
	}

	@Bean
	public CrmCustomTargetBuilder crmCustomTargetBuilder() {
		return new CrmCustomTargetBuilder();
	}

	@Bean
	public ApproveTargetBuilder approveTargetBuilder() {
		return new ApproveTargetBuilder();
	}

	@Bean
	public AttendanceTargetBuilder attendanceTargetBuilder() {
		return new AttendanceTargetBuilder();
	}

	@Bean
	public ReportTargetBuilder reportTargetBuilder() {
		return new ReportTargetBuilder();
	}

	@Bean
	public OtherTargetBuilder otherTargetBuilder() {
		return new OtherTargetBuilder();
	}

	@Bean
	public PlatformTargetBuilder platformTargetBuilder() {
		return new PlatformTargetBuilder();
	}

	@Bean
	public BriefReportTargetBuilder briefReportTargetBuilder() {
		return new BriefReportTargetBuilder();
	}

	@Bean
	public OperationTargetBuilder operationTargetBuilder() {
		return new OperationTargetBuilder();
	}

	@Bean("targetBuilderMap")
	public Map<Integer, TargetBuilder> targetBuilderMap(TaskTargetBuilder taskTargetBuilder,
			CrmSaleTargetBuilder crmSaleTargetBuilder, CrmCustomTargetBuilder crmCustomTargetBuilder,
			ApproveTargetBuilder approveTargetBuilder, AttendanceTargetBuilder attendanceTargetBuilder,
			ReportTargetBuilder reportTargetBuilder, OtherTargetBuilder otherTargetBuilder,
			PlatformTargetBuilder platformTargetBuilder, BriefReportTargetBuilder briefReportTargetBuilder,
			OperationTargetBuilder operationTargetBuilder) {
		ConcurrentHashMap<Integer, TargetBuilder> targetBuilderMap = new ConcurrentHashMap<>();
		targetBuilderMap.put(7000, taskTargetBuilder);
		targetBuilderMap.put(9000, crmSaleTargetBuilder);
		targetBuilderMap.put(9500, crmCustomTargetBuilder);
		targetBuilderMap.put(6500, approveTargetBuilder);
		targetBuilderMap.put(8000, attendanceTargetBuilder);
		targetBuilderMap.put(6000, reportTargetBuilder);
		targetBuilderMap.put(19000, otherTargetBuilder);

		targetBuilderMap.put(28200, platformTargetBuilder);
		targetBuilderMap.put(30100, briefReportTargetBuilder);
		targetBuilderMap.put(31100, operationTargetBuilder);
		return targetBuilderMap;
	}

	@Bean("targetBuilderFactory")
	public TargetBuilderFactoryImpl targetBuilderFactory(Map<Integer, TargetBuilder> targetBuilderMap) {
		TargetBuilderFactoryImpl targetBuilderFactory = new TargetBuilderFactoryImpl();
		targetBuilderFactory.setBuilderMap(targetBuilderMap);
		return targetBuilderFactory;
	}

	@Bean
	public TargetBuilderCenter targetBuilderCenter(TargetBuilderFactoryImpl targetBuilderFactory) {
		TargetBuilderCenter targetBuilderCenter = new TargetBuilderCenter();
		targetBuilderCenter.setBuilderFactory(targetBuilderFactory);
		return targetBuilderCenter;
	}

	@Bean("mqBus")
	public MqBusImpl mqBus() {
		return new MqBusImpl();
	}

	/**************** mq观察者 ***************/
	@Bean(name = "mqTargetObservable")
	public CommonObservable mqTargetObservable(ReportObserver reportObserver, AttendanceObserver attendanceObserver,
			ApproveObserver approveObserver, TaskObserver taskObserver) {
		CommonObservable mqTargetObservable = new CommonObservable();
		List<Observer> observers = new ArrayList<>();
		observers.add(reportObserver);
		observers.add(attendanceObserver);
		observers.add(approveObserver);
		observers.add(taskObserver);

		// observers.add(crmCustomerObserver);

		mqTargetObservable.setObservers(observers);
		return mqTargetObservable;
	}

}
